package com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.view;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.support.v7.widget.CardView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.hzdesk.media.matvector.koreabatch.client.my_paperless.R;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.base.BaseActivity;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.custom_view.MyRecyclerView;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.contract.IManageProfilesPagerContract;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.persenter.ManageProfilesPagerPersenter;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.utils.MyToastUtils;

/**
 * Created by Administrator on 2018/8/15.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 */

public class ManageProfilesPagerActivity extends BaseActivity implements IManageProfilesPagerContract.IManageProfilesPagerView {

    private MyRecyclerView my_recylerview_02;
    private RelativeLayout rl_add_config;
    private RelativeLayout rl;
    private ImageView empty_view;

    private ManageProfilesPagerPersenter mManageProfilesPagerPersenter = new ManageProfilesPagerPersenter(this);
    private CardView cv_add_config;
    private String file_device_attrib;

    @Override
    protected void userAgreedPermissions() {

    }

    @Override
    protected View AddLayoutView() {
        View view = View.inflate(this, R.layout.activity_manage_profile_pager,null);
        my_recylerview_02 = view.findViewById(R.id.fragment_devices_manager_my_recylerview_02);
        rl_add_config = view.findViewById(R.id.activity_manage_profile_pager_rl_add_config);
        cv_add_config = view.findViewById(R.id.activity_manage_profile_pager_cv_add_config);
        rl = view.findViewById(R.id.my_recyclerview_empty_rl);
        empty_view = view.findViewById(R.id.iv_prompt_empty_view);
        return view;
    }

    @Override
    protected void initChildViewDate() {
        Intent intent = getIntent();
        file_device_attrib = intent.getStringExtra("file_device_attrib");
        mManageProfilesPagerPersenter.initTtitle();
        mManageProfilesPagerPersenter.initRecyclerView(my_recylerview_02,this);
        rl_add_config.setOnClickListener(new View.OnClickListener() {
            @SuppressLint("LongLogTag")
            @Override
            public void onClick(View view) {
                // todo 添加配置文件
                mManageProfilesPagerPersenter.onClickedAddConfig();

            }
        });
    }

    @Override
    protected void onStart() {
        super.onStart();
        mManageProfilesPagerPersenter.loadDate(this, file_device_attrib);
    }

    @Override
    protected void onClickedTvRight() {

    }

    @Override
    protected void onClickedIvRight() {

    }

    @Override
    protected void onClickedIvLeft() {
            finish();
    }

    @Override
    public void showTitle() {
        showTilteBg();
        showTitleContent();
        showTileIvLeft();
        //设备管理(6)
        setTitleContent("管理配置文件", 0xffffffff);
        setIvLeftIcon(R.mipmap.left_white_return);
        setTitleContentSize(16);
    }

    @Override
    public void showCVConfig() {
        cv_add_config.setVisibility(View.VISIBLE);
    }

    @Override
    public void hidenCVconfig() {
        cv_add_config.setVisibility(View.GONE);
    }

    @Override
    public void toAddConfigPager(String devicesId) {
        Intent intent =  new Intent(ManageProfilesPagerActivity.this,AddConfigFileActivity.class);
        intent.putExtra("my_devices_id",devicesId);
        startActivity(intent);
    }

    @Override
    public void showToastMessage(String message) {
        MyToastUtils.ShortToaseShow(this,message);
    }
}
